package com.open.jack.jk_mpchart;

import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineDataSet;

import java.util.ArrayList;
import java.util.List;

/**
 * @TODO
 * @author: clf
 * @since: 2020/11/27
 */
public class IotLineDataSet extends LineDataSet {


    public IotLineDataSet(List<Entry> yVals, String label) {
        super(yVals, label);
    }

    @Override
    public Entry getEntryForXValue(float xValue, float closestToY) {
        return super.getEntryForXValue(xValue, closestToY);
    }

    @Override
    public Entry getEntryForXValue(float xValue, float closestToY, Rounding rounding) {
        return super.getEntryForXValue(xValue, closestToY, rounding);
    }

    @Override
    public List<Entry> getEntriesForXValue(float xValue) {
        return super.getEntriesForXValue(xValue);
    }

    public List<Entry> getEntriesForYValue(float yValue) {
        List<Entry> entries = new ArrayList<Entry>();
        for (Entry entry : mEntries) {
            if (entry.getY() == yValue) {
                entries.add(entry);
            }
        }
        return entries;
    }
}
